<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%@page import="model.pojo.*"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
    <%
            request.setAttribute("pageTitle", "Edit My Profile");
    %>
    <%@ include file="/WEB-INF/jspf/header.jspf"%>
    <%
            if (request.getAttribute("userProfile") != null) {
                UserProfile up = (UserProfile) request.getAttribute("userProfile");
                String username = (String) request.getAttribute("userName");
    %>
<div class="portion">    
<form action="saveProfileChanges.do" method="POST">    
        <table border="0">
            <tbody>
                <tr>
                    <td>Profile Picture</td>
                    <td>
                        <%
        if (up.getPhotoLink() == null) {
            up.setPhotoLink("");
        }
        if (up.getPhotoLink().equals("")) {
                        %>
                        <img src="./images/defualtProfileLogo.gif">
                        <%                    } else {
                        %>
                        <img src="<%=up.getPhotoLink()%>">
                        <%
        }
                        %>
                    </td>
                </tr>
                <tr>
                    <td>
                        Profile Picture URL
                    </td>
                    <td><input type="text" name="photoLink" style="width: 80%" value="<%=up.getPhotoLink()%>" /></td>
                </tr>
                <tr>
                    <td>Display Name</td>
                    <td><input type="text" name="" value="<%=username%>" readonly="readonly" /></td>
                </tr>
                
                <tr>
                    <td>Age</td>
                    <td><input type="text" name="age" value="<%
        if (up.getAge() > 0) {
            out.print(up.getAge());
        } else {
            out.print("not set yet");
        }
                               %>" /></td>
                </tr>
                <tr>
                    <td>Gender</td>
                    <td>
                        <select name="gender">
                            <%
        if (up.getGender() == null) {
            up.setGender("");
        }
        if (up.getGender().equals("male")) {
                            %>
                            <option value="male" selected="selected">Male</option>
                            <option value="female">Female</option>
                            <%                        } else if (up.getGender().equals("female")) {
                            %>
                            <option value="male">Male</option>
                            <option value="female" selected="selected">Female</option>
                            <%        } else {
                            %>
                            <option value="male">Male</option>
                            <option value="female">Female</option>
                            <%                        }
                            %>
                        </select>
                    </td>
                </tr>
                <tr>
                    <td>Country</td>
                    <td></td>
                </tr>
                
                <tr>
                    <td>About You</td>
                    <td>
                        <%if (up.getAboutMe() == null) {
            up.setAboutMe("nothing said here");
        }%>
                        <textarea name="aboutMe" rows="10" cols="70" style="width: 80%"><%=up.getAboutMe()%></textarea>
                    </td>
                </tr>
                <tr>
                    <td>Introduction of Your Self</td>
                    <td>
                        <%if (up.getMyInterest() == null) {
            up.setMyInterest("nothing said here");
        }%>
                        <textarea name="myInterest" rows="10" cols="70" style="width: 80%"><%=up.getMyInterest()%></textarea>
                    </td>
                </tr>
                <tr>
                    <td>Intro Video</td>
                    <td>
                        <%
        if (up.getVideoLink() == null) {
            up.setVideoLink("");
        }
        if (!up.getVideoLink().equals("")) {
                        %>
                        <%=up.getVideoLink()%>
                        <%
                        } else {
                        %>
                        no video code uploaded yet.
                        <%        }
                        %>
                    </td>
                </tr>
                <tr>
                    <td>the video (HTML)code</td>
                    <td>
                        <textarea name="videoLink"  rows="10" cols="70" style="width: 80%"><%=up.getVideoLink()%></textarea>
                    </td>
                </tr>
                <tr>
                    <td></td>
                    <td align="center"><input type="submit" value="Save" /></td>
                </tr>
            </tbody>
        </table> 
    </form>
</div>
    <%    } else {
    %>
    Error... Please tell the Admins!
    <%            }
    %>
    <%@ include file="/WEB-INF/jspf/footer.jspf"%>
</html>
